window.onload =function (ev) {
    let allLis=document.getElementsByClassName('tabtitle')
    let content =document.getElementsByClassName('tabct');
//遍历监听
    for(let i=0;i<allLis.length;i++){
        let li=allLis[i];
        li.index=i;
        li.onclick=function () {
            for(let j=0;j<allLis.length;j++){
                allLis[j].className='tabtitle ';
                content[j].style.display='none';
            }
            this.className='tabtitle selected';
            content[this.index].style.display='block';

        }
    }
}
/*
function $(id) {
    return typeof id === "string" ? document.getElementById(id) : null;
}*/
function  $(e) {
    return document.querySelector(e);
}